import { type IDomEditor, DomEditor } from "@wangeditor/editor";
import { constant } from "./constant";
function withAttachment<T extends IDomEditor>(editor: T) {
  const { isVoid } = editor;
  const newEditor = editor;
  newEditor.isVoid = (elem) => {
    const type = DomEditor.getNodeType(elem);
    if (type === constant.type) return true;
    return isVoid(elem);
  };

  return newEditor;
}
export default withAttachment;
